package com.ruoyi.resume.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.resume.domain.BoleResumeHonor;
import com.ruoyi.resume.service.IBoleResumeHonorService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 荣誉奖项Controller
 * 
 * @author ruoyi
 * @date 2025-04-01
 */
@RestController
@RequestMapping("/resume/honor")
public class BoleResumeHonorController extends BaseController
{
    @Autowired
    private IBoleResumeHonorService boleResumeHonorService;

    /**
     * 查询荣誉奖项列表
     */
    @PreAuthorize("@ss.hasPermi('resume:honor:list')")
    @GetMapping("/list")
    public TableDataInfo list(BoleResumeHonor boleResumeHonor)
    {
        startPage();
        List<BoleResumeHonor> list = boleResumeHonorService.selectBoleResumeHonorList(boleResumeHonor);
        return getDataTable(list);
    }

    /**
     * 导出荣誉奖项列表
     */
    @PreAuthorize("@ss.hasPermi('resume:honor:export')")
    @Log(title = "荣誉奖项", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BoleResumeHonor boleResumeHonor)
    {
        List<BoleResumeHonor> list = boleResumeHonorService.selectBoleResumeHonorList(boleResumeHonor);
        ExcelUtil<BoleResumeHonor> util = new ExcelUtil<BoleResumeHonor>(BoleResumeHonor.class);
        util.exportExcel(response, list, "荣誉奖项数据");
    }

    /**
     * 获取荣誉奖项详细信息
     */
    @PreAuthorize("@ss.hasPermi('resume:honor:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(boleResumeHonorService.selectBoleResumeHonorById(id));
    }

    /**
     * 新增荣誉奖项
     */
    @PreAuthorize("@ss.hasPermi('resume:honor:add')")
    @Log(title = "荣誉奖项", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BoleResumeHonor boleResumeHonor)
    {
        return toAjax(boleResumeHonorService.insertBoleResumeHonor(boleResumeHonor));
    }

    /**
     * 修改荣誉奖项
     */
    @PreAuthorize("@ss.hasPermi('resume:honor:edit')")
    @Log(title = "荣誉奖项", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BoleResumeHonor boleResumeHonor)
    {
        return toAjax(boleResumeHonorService.updateBoleResumeHonor(boleResumeHonor));
    }

    /**
     * 删除荣誉奖项
     */
    @PreAuthorize("@ss.hasPermi('resume:honor:remove')")
    @Log(title = "荣誉奖项", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(boleResumeHonorService.deleteBoleResumeHonorByIds(ids));
    }
}
